package tiled.mapeditor.widget;

import java.awt.Insets;
import javax.swing.Action;
import javax.swing.JButton;

public class TButton extends JButton
{
    private boolean showText;

    public TButton()
    {
        setMargin(new Insets(0, 0, 0, 0));
    }

    public TButton(boolean showText)
    {
        this();
        this.showText = showText;
    }

    public TButton(Action action)
    {
        this(action, false);
    }

    public TButton(Action action, boolean showText)
    {
        this(showText);
        setAction(action);
    }

    public void setShowText(boolean showText)
    {
        this.showText = showText;
    }

    public void setText(String text)
    {
        if (showText)
        {
            super.setText(text);
        }
    }
}
